package com.nation.nationslidemenu;



import android.annotation.SuppressLint;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebSettings.LayoutAlgorithm;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ProgressBar;

public class WebviewActivity extends Activity  {

	
	
	
	
	
	public static String URL="https://www.google.co.th";
	
	@SuppressLint({ "SetJavaScriptEnabled", "CutPasteId" })
	@SuppressWarnings("deprecation")
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.webview_screen);

		
			
			ProgressBar progress=(ProgressBar)findViewById(R.id.progressBar);
		    WebView webView = (WebView) findViewById(R.id.webView1);
	        webView.getSettings().setJavaScriptEnabled(true); 
	        webView.getSettings().setTextSize(WebSettings.TextSize.NORMAL);
	       //webView.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
	        webView.setWebChromeClient(new WebChromeClient() {
	        	
	        	
	        	ProgressBar mProgress=(ProgressBar)findViewById(R.id.progressBar);	
	            public void onProgressChanged(WebView view, int progress)
	            {
					mProgress.setProgress(progress);
	                Log.e("TNT",""+(progress)+"");
	              if(progress==100)
	              {
	            	  mProgress.setVisibility(View.GONE);
	              }
	            }

	        });
	 
	        webView.setWebViewClient(new WebViewClient() {
	            @Override
	            public void onReceivedError(WebView view, int errorCode, String description, String failingUrl)
	            {

	            }
	 
	            @Override
	            public boolean shouldOverrideUrlLoading(WebView view, String url)
	            {
	                return true;
	            }
	        });
	        webView.loadUrl(URL);
	        
		
	}
	
	
}
